using UnityEngine;

public class LoadingText : MonoBehaviour
{
	public UILabel label;

	public string loadingText;

	public float dotLoadSeconds = 1f;

	public int maxDots = 3;

	private float currentTimer;

	private int dotCount;

	private void OnEnable()
	{
		currentTimer = 0f;
		dotCount = 0;
		string message = GetMessage();
		UITools.ChangeText(label, message);
	}

	private string GetMessage()
	{
		string text = loadingText;
		for (int i = 0; i < dotCount; i++)
		{
			text += ".";
		}
		return text;
	}

	private void Update()
	{
		currentTimer += Time.deltaTime;
		if (currentTimer >= dotLoadSeconds)
		{
			currentTimer = 0f;
			dotCount = ((dotCount < maxDots) ? (dotCount + 1) : 0);
		}
		string message = GetMessage();
		UITools.ChangeText(label, message);
	}
}
